package com.topfinance.ui;

import java.io.Serializable;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

import com.topfinance.frame.exception.AppException;
import com.topfinance.payment.ebo.TCfgOperationEbo;
import com.topfinance.payment.service.impl.TCfgOperationMgrImpl;

public class UIHelper {
	public static void debug(String s) {
		System.out.println(s);
	}

	protected static XmlBeanFactory f3 = null;
	protected void init() {
		if (f3 == null) {
			XmlBeanFactory f1 = new XmlBeanFactory(new ClassPathResource("/spring/applicationContext.xml"));
			XmlBeanFactory f2 = new XmlBeanFactory(new ClassPathResource("/spring/dataAccessContext-hibernate.xml"), f1);
			f3 = new XmlBeanFactory(new ClassPathResource("/spring/serviceContext.xml"), f2);
		}
	}
	
	/**
	 * 获得某对象
	 * 
	 * @return 对象
	 */
	public Object get(Class temp,Serializable id) throws AppException {
		TCfgOperationMgrImpl impl = (TCfgOperationMgrImpl) f3.getBean("cfgOperationMgr");
		return impl.get(temp,id);
	}

}
